//index.js
//获取应用实例
const app = getApp()
var HttpUtil = require('../../utils/httpUtil.js');
Page({
  data: {
    artlist: [
      // { imag: 'https://songling.oss-cn-beijing.aliyuncs.com/WechatIMG10.png', art: "火锅的正确吃法，你知道吗" },
      // { imag: 'https://songling.oss-cn-beijing.aliyuncs.com/WechatIMG11.png', art: "原来蟹还可以这么吃" },
      // { imag: 'https://songling.oss-cn-beijing.aliyuncs.com/WechatIMG11.png', art: "语音还能知道摄入量" },
      // { imag: 'https://songling.oss-cn-beijing.aliyuncs.com/WechatIMG10.png', art: "食物拍照就能知道营养物质啦" }
      
    ]
    
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../home/home'
    })
  },
  canting: function(){
    wx.navigateTo({
      url: '../canting/canting',
    })
  },
  yy:function(){
    wx.navigateTo({
      url: '../voice/index',
    })
  },
  tj:function(){
    // wx.showToast({
    //   title: '敬请期待',
    //   icon: 'success',
    //   duration:1000
    // })


    wx.navigateTo({
      url:'../check/check'
    })
  },
  yd:function(){
    // wx.showToast({
    //   title: '敬请期待',
    //   icon: 'success',
    //   duration:1000
    // })


    wx.navigateTo({
      url: '../sports/sports'
    })
  },
  onLoad: function () {
   
  },

  onShow:function(){
    let that=this
    var url = app.globalData.serverPath + '/wxMp/getNews';
    HttpUtil.GET(url, {}).then((res) => {
      let articles=res.data.result[0].content.articles
      that.setData({
        artlist: articles

      })
      console.log(res)
    }).catch((errMsg) => {
      console.log("查询使用者信息失败", errMsg);
    });
  },
  artinfo: function (e) {

   // console.log("导航url：",e.currentTarget.dataset.arturl)
      wx.navigateTo({
        url: '../article/article?arturl=' +encodeURIComponent(e.currentTarget.dataset.arturl),
      })
  },

  getUserInfo: function(e) {
    console.log(e)
    app.globalData.userInfo = e.detail.userInfo
    this.setData({
      userInfo: e.detail.userInfo,
      hasUserInfo: true
    })
  }
})
